package com.h824;

import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class SetTest {
    public static void main(String[] args) {
        //数组去除重复数据。
        String[] names = {"a","b","a","c","b","d","e"};
        List<String> list = Arrays.asList(names);
        Set<String> set = new HashSet<>();
        set.addAll(list);
        System.out.println(set);
        Object[] objs = set.toArray();
        String[] strs = new String[set.size()];
        strs = set.toArray(strs);
        System.out.println(Arrays.toString(strs));
    }
}
